package com.corner.ui.activity;

import android.os.Bundle;

import com.corner.R;
import com.corner.presenter.base.BasePresenter;
import com.corner.ui.base.BaseActivity;
import com.corner.ui.base.BaseFragment;
import com.corner.ui.base.MutiFragment;
import com.corner.ui.fragment.ForgetPasswordFragment;
import com.corner.ui.fragment.GetSmsCodeFragment;
import com.corner.ui.fragment.LoginFragment;
import com.corner.ui.fragment.SetNewPasswordFragment;
import com.corner.ui.fragment.SetPasswordFragment;
import com.corner.utils.AppManager;

public class LoginAndRegisterActivity extends BaseActivity implements
        MutiFragment {

    private GetSmsCodeFragment getSmsCodeFragment;
    private LoginFragment loginFragment;
    private ForgetPasswordFragment forgetPasswordFragment;
    private SetNewPasswordFragment setNewPasswordFragment;
    private SetPasswordFragment setPasswordFragment;

    @Override
    protected void initData() {
    }

    @Override
    public void setContentView() {
        setContentView(R.layout.activity_login_register);
        changeFragment(getLoginFragment(), null, false);
//        Bundle bundle = new Bundle();
//        bundle.putString(SetPasswordFragment.PHONE_NUM, "13871286317");
//        getSetPasswordFragment().setArguments(bundle);
//        changeFragment(getSetPasswordFragment(),null,false);
    }

    @Override
    public int getLayoutId() {
        return R.id.fl_login_register;
    }

    /**
     * 去主页面
     */
    public void goHome() {
        jump(MainActivity.class);
        AppManager.getInstance().finishActivity(this);
    }

    @Override
    protected BasePresenter createP() {
        return null;
    }

    @Override
    protected void setOnClick() {
    }

    public SetPasswordFragment getSetPasswordFragment() {
        setPasswordFragment = setPasswordFragment == null ? new SetPasswordFragment() : setPasswordFragment;
        return setPasswordFragment;
    }

    public GetSmsCodeFragment getGetSmsCodeFragment() {
        getSmsCodeFragment = getSmsCodeFragment == null ? new GetSmsCodeFragment() : getSmsCodeFragment;
        return getSmsCodeFragment;
    }

    public LoginFragment getLoginFragment() {
        loginFragment = loginFragment == null ? new LoginFragment() : loginFragment;
        return loginFragment;
    }

    public ForgetPasswordFragment getForgetPasswordFragment() {
        forgetPasswordFragment = forgetPasswordFragment == null ? new ForgetPasswordFragment() : forgetPasswordFragment;
        return forgetPasswordFragment;
    }

    public SetNewPasswordFragment getSetNewPasswordFragment() {
        setNewPasswordFragment = setNewPasswordFragment == null ? new SetNewPasswordFragment() : setNewPasswordFragment;
        return setNewPasswordFragment;
    }
}
